<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var sNodes = [
        {
            "id": 92,
            "name": "工作台",
            "open": "true",
            "checked": "true"
        },
        {
            "id": 1,
            "name": "系统管理",
            "open": "true",
            "checked": "true"
        },
        {
            "id": 93,
            "pId": 92,
            "name": "通知公告",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 8,
            "pId": 1,
            "name": "用户管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 2,
            "pId": 1,
            "name": "角色管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 25,
            "pId": 1,
            "name": "菜单管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 34,
            "pId": 1,
            "name": "字典管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 39,
            "pId": 1,
            "name": "部门管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 44,
            "pId": 1,
            "name": "附件管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 56,
            "pId": 1,
            "name": "参数化管理",
            "open": "false",
            "checked": "false"
        },
        {
            "id": 65,
            "pId": 1,
            "name": "连接池监视",
            "open": "false",
            "checked": "false"
        },
        {
            "id": 81,
            "pId": 1,
            "name": "日志管理",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 1000,
            "pId": 81,
            "name": "日志管理1000",
            "open": "false",
            "checked": "true"
        },
        {
            "id": 1001,
            "pId": 81,
            "name": "日志管理1001",
            "open": "false",
            "checked": "true"
        }
    ]
    var tmpMap = {}, result = [];
    for (var i = 0; i < sNodes.length; i++) {
        tmpMap[sNodes[i]['id']] = sNodes[i];
    }
    debugger;
    for (var i = 0; i < sNodes.length; i++) {
        var node = sNodes[i];
        if (tmpMap[node.pId]) {
            if(!tmpMap[node.pId]['children'])
                tmpMap[node.pId]['children'] = [];
            tmpMap[node.pId]['children'].push(node);
        } else {
            result.push(sNodes[i]);
        }

    }
    console.log(result);


</script>
</body>
</html>